<?php
//	jQuery::Initialize('');
//	jQuery::Initialize('pepper-grinder');
	
	XHTML::Style("
		div.ui-datepicker, .ui-datepicker td
		{
			font-size: 15px;
		}
	");
	
	echo "<div id = 'calendarContainer' style = 'margin-left: 0px; '></div>";	
	jQuery::Datepicker('calendarContainer', array(
		'maxDate' => 0,
		'dateFormat' => "'yy-mm-dd'",
		'beforeShowDay' => 'BeforeShowDate',
		'onSelect' => 'function(dateText, inst) 
		{
			$.post("/clients/getfollowersbydate/" + dateText, {}, AfterDate, "");
		}',
		'onChangeMonthYear' => 'function(year, month, inst) { $.ajax({async: false, url: "/clients/getfollowersbymonth/" + month + "/" +year, type: "POST", success: AfterMonth }); }'
	));
	
	XHTML::Script('text/javascript', '
		$.ajax({async: false, url: "/clients/getfollowersbymonth/", type: "POST", success: AfterMonth });
		function AfterMonth(data) 
		{
			eval(data);
		}
		
		function AfterDate(result)
		{
			$("#dateBoxText").html(result);
			$("#dateBox").dqDialog("open", {width:"350", top:"285"});
			$("#btnCloseContainer").attr("style", "float: right; ");
		}
		
		//before date in calendar is shown
		function BeforeShowDate(date)
		{
			dateObj = new Date(date);
			year = dateObj.getFullYear();
			month = dateObj.getMonth() + 1;
			date = dateObj.getDate();		
			if (window.followers[date] > 0)
			{
				result = new Array(true, "tbold");
			}
			else
			{
				result = new Array(true, "");
			}
			return result;
			
//			var result = new Array(true, "", "");
//			window.isEnabled = false;
//			window.dateClass = "";
//			dateObj = new Date(date);
//			year = dateObj.getFullYear();
//			month = dateObj.getMonth() + 1;
//			date = dateObj.getDate();
//			$.ajax({async: false, url: "/clients/hasfollowersbydate/" + year + "-" + month + "-" + date, type: "POST", success: AfterDateChecked });
//			result[0] = window.isEnabled;
//			result[1] = window.dateClass;
//			return result;
		}
		
		function AfterDateChecked(data, textStatus, jqXHR)
		{
			if (data == 1)
			{
				window.dateClass = "tbold";
				window.isEnabled = true;
			}
		}
	');
	
	//message
	echo "
		<div id='dateBox' style='display: none; font-size: 13px !important;' >
			<div class='lp1 lpad10 rpad10 bpad10'><span class='size18'>".Language::Get('Followers')."</span></div>
		  	<div class='lpad10 rpad10 tpad10'>
				<span id = 'dateBoxText'></span>
		  	</div>
		</div>				
	";
	
	XHTML::Script('text/javascript', '
		$("#dateBox").dqDialog({title: "'.Language::Get('Message').'"});
	');
	
//	echo "
//         <table border='0' cellspacing='0' cellpadding='0' width='100%'>
//          <tr>
//            <td width='5' height='5'><img src='/app/themes/default/img/c4_left_top.png' alt='' /></td>
//            <td class='c4_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//            <td width='5'><img src='/app/themes/default/img/c4_right_top.png' alt='' /></td>
//          </tr>
//          
//          <tr>
//            <td class='c4_bg_left'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//            <td valign='top' class='c4_txt'>
//              
//              <div class='bpad15'>
//                <table border='0' cellspacing='0' cellpadding='0' width='100%'><tr>
//                 <td width='25'><span class='dq-icons-25x25 dq-icon-prev'></span></td>
//                 <td align='center'><span class='datepicker-month'>July 2011</span></td>
//                 <td width='25'><span class='dq-icons-25x25 dq-icon-next'></span></td>
//                </tr></table>                
//              </div>
//              <table border='0' cellspacing='0' cellpadding='0' width='100%'>
//               <tr>
//                 <td width='10' height='10'><img src='/app/themes/default/img/c5_left_top.png' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_top'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td width='10'><img src='/app/themes/default/img/c5_right_top.png' alt='' /></td>
//               </tr>
//               
//               <tr class='c5_bg_top'>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='pad5 size14 c55'>Mon</td>
//                 <td class='pad5 size14 c55'>Tue</td>
//                 <td class='pad5 size14 c55'>Wed</td>
//                 <td class='pad5 size14 c55'>Thu</td>
//                 <td class='pad5 size14 c55'>Fri</td>
//                 <td class='pad5 size14 c55'>Sat</td>
//                 <td class='pad5 size14 c55'>Sun</td>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//               </tr>
//               
//               <tr class='bg_b6'>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='datepicker-day-sel'>1</td>
//                 <td class='datepicker-day'>2</td>
//                 <td class='datepicker-day'>3</td>
//                 <td class='datepicker-day'>4</td>
//                 <td class='datepicker-day'>5</td>
//                 <td class='datepicker-day'>6</td>
//                 <td class='datepicker-day'>7</td>
//                 <td ><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//               </tr>
//               
//               <tr>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='datepicker-day'>8</td>
//                 <td class='datepicker-day'>9</td>
//                 <td class='datepicker-day'>10</td>
//                 <td class='datepicker-day'>11</td>
//                 <td class='datepicker-day'>12</td>
//                 <td class='datepicker-day'>13</td>
//                 <td class='datepicker-day'>14</td>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//               </tr>
//               
//               <tr class='bg_b6'>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='datepicker-day'>15</td>
//                 <td class='datepicker-day'>16</td>
//                 <td class='datepicker-day'>17</td>
//                 <td class='datepicker-day'>18</td>
//                 <td class='datepicker-day'>19</td>
//                 <td class='datepicker-day'>20</td>
//                 <td class='datepicker-day'>21</td>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//               </tr>
//               
//               <tr>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='datepicker-day'>22</td>
//                 <td class='datepicker-day'>23</td>
//                 <td class='datepicker-day'>24</td>
//                 <td class='datepicker-day'>25</td>
//                 <td class='datepicker-day'>26</td>
//                 <td class='datepicker-day'>27</td>
//                 <td class='datepicker-day'>28</td>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//               </tr>
//               
//               <tr class='bg_b6'>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='datepicker-day'>29</td>
//                 <td class='datepicker-day'>30</td>
//                 <td class='datepicker-day'>31</td>
//                 <td class='datepicker-day'></td>
//                 <td class='datepicker-day'></td>
//                 <td class='datepicker-day'></td>
//                 <td class='datepicker-day'></td>
//                 <td><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//               </tr>
//               
//               <tr>
//                 <td width='10' height='10'><img src='/app/themes/default/img/c5_left_bottom.png' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td class='c5_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//                 <td width='10'><img src='/app/themes/default/img/c5_right_bottom.png' alt='' /></td>
//               </tr>
//              </table>
//               
//            </td>
//            <td class='c4_bg_right'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//          </tr>
//          
//          <tr>
//            <td width='5' height='5'><img src='/app/themes/default/img/c4_left_bottom.png' alt='' /></td>
//            <td class='c4_bg_bottom'><img src='".SITE_IMAGES."vid.gif' alt='' /></td>
//            <td width='5'><img src='/app/themes/default/img/c4_right_bottom.png' alt='' /></td>
//          </tr>				          
//         </table>	
//	";
?>